package com.eunion.web.character.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.fastjson.annotation.JSONField;
import com.eunion.core.LogUtil;
import com.eunion.web.character.repository.CharacterClassRepository;
import com.eunion.web.character.service.CharacterClassService;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
 * 性格测试题目选项
 * @author changzuzhe
 */
@Entity
@Table(name = "character_option")
//@JsonIgnoreProperties({"topic"})
public class CharacterOption implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7936496351037182639L;
	
	@Column(name = "id")
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Id
	private int id;
    @Column(name = "content")
	private String content;//选项内容
    
    /**
     * {@link CharacterClass#getValue()}
     */
    @Column(name = "lx")
	private String lx;//选项对应的性格类型
    
    @Column(name = "lx_name")
    private String lxName;
    @Column(name = "fz")
	private String fz;//分值
    
    /*@JoinColumn(name = "topic_id")
    @ManyToOne(targetEntity = CharacterTopic.class)
    private String topicId;*/
    @JoinColumn(name = "topic_id")
    @ManyToOne(targetEntity = CharacterTopic.class)
    private CharacterTopic characterTopic;
    
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getLx() {
		return lx;
	}

	public void setLx(String lx) {
		//LogUtil.get(this.getClass()).error("czz:" + lx);
		this.lx = lx;
		//CharacterClass characterClass =	classService.findOne(Integer.parseInt(lx));
		//lxName = characterClass.getName();
	}

	public String getFz() {
		return fz;
	}

	public void setFz(String fz) {
		this.fz = fz;
	}
	
	

	
	public String getLxName() {
		return lxName;
	}

	public void setLxName(String lxName) {
		this.lxName = lxName;
	}

	public CharacterTopic getCharacterTopic() {
		return characterTopic;
	}

	public void setCharacterTopic(CharacterTopic characterTopic) {
		this.characterTopic = characterTopic;
	}

	public String toString() {
		return "{" + "id:" + id +"\n"
				+ "content:" + content +"\n"
				+ "lx:" + lx +"\n"
				+ "fz:" + fz
				+  "}";
	}
}
